package com.cook.service;

import com.cook.dto.recipes.IngredientDTO;
import com.cook.entity.Ingredients;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cook.vo.recipes.IngredientVO;

import java.util.List;

/**
* @author black-white spider
* @description 针对表【ingredients(食谱食材表)】的数据库操作Service
* @createDate 2025-10-27 19:54:38
*/
public interface IngredientsService extends IService<Ingredients> {
    /**
     * 根据食谱ID查询食材列表
     * @param recipeId 食谱ID
     * @return 食材列表
     */
    List<IngredientVO> getIngredientsByRecipeId(Long recipeId);

    /**
     * 根据食材ID查询食材详情
     * @param ingredientId 食材ID
     * @return 食材详情
     */
    IngredientVO getIngredientById(Long ingredientId);

    /**
     * 添加食材
     * @param ingredientDTO 食材DTO
     * @return 食材ID
     */
    Long addIngredient(IngredientDTO ingredientDTO);

    /**
     * 批量添加食材
     * @param ingredientDTOList 食材DTO列表
     * @return 是否成功
     */
    boolean batchAddIngredients(List<IngredientDTO> ingredientDTOList);

    /**
     * 更新食材
     * @param ingredientDTO 食材DTO
     * @return 是否成功
     */
    boolean updateIngredient(IngredientDTO ingredientDTO);

    /**
     * 删除食材
     * @param ingredientId 食材ID
     * @return 是否成功
     */
    boolean deleteIngredient(Long ingredientId);

    /**
     * 根据食谱ID删除所有食材
     * @param recipeId 食谱ID
     * @return 是否成功
     */
    boolean deleteIngredientsByRecipeId(Long recipeId);

    /**
     * 复制食材到新食谱
     * @param sourceRecipeId 源食谱ID
     * @param targetRecipeId 目标食谱ID
     * @return 是否成功
     */
    boolean copyIngredientsToRecipe(Long sourceRecipeId, Long targetRecipeId);
}
